package com.example.mapper;

import org.apache.ibatis.annotations.Mapper;
import com.example.pojo.overtimeMonitoringPojo;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

@Mapper
public interface overtimeMonitoringMapp {

    @DS("newMscLowCodeTest")
    @Select("SELECT * FROM ddm_overtime_monitoring WHERE sys_deleted = 0 LIMIT #{pageSize} OFFSET #{offset}")
    List<overtimeMonitoringPojo> queryByPage(int offset, int pageSize);

    @DS("newMscLowCodeTest")
    @Select("SELECT COUNT(*) FROM ddm_overtime_monitoring WHERE sys_deleted = 0")
    int queryTotalCount();

    @DS("newMscLowCodeTest")
    @Insert("INSERT INTO ddm_overtime_monitoring (" +
            "id, create_time, update_time, creator, process_status, sys_update_user, " +
            "sys_audit_user, sys_audit_time, sys_deleted, name, employeeNumber, department, " +
            "section, overtimeHour, operation, category, reason, overtimeDate" +
            ") VALUES (" +
            "#{id}, #{create_time}, #{update_time}, #{creator}, #{process_status}, #{sys_update_user}, " +
            "#{sys_audit_user}, #{sys_audit_time}, #{sys_deleted}, #{name}, #{employeeNumber}, #{department}, " +
            "#{section}, #{overtimeHour}, #{operation}, #{category}, #{reason}, #{overtimeDate}" +
            ")")
    void insertOne(overtimeMonitoringPojo overtimeMonitoringPojo);

    @DS("newMscLowCodeTest")
    @Select("SELECT * FROM ddm_overtime_monitoring WHERE sys_deleted = 0")
    List<overtimeMonitoringPojo> queryAll();

    @DS("newMscLowCodeTest")
    @Update("UPDATE ddm_overtime_monitoring SET " +
            "update_time = #{update_time}, " +
            "name = #{name}, " +
            "employeeNumber = #{employeeNumber}, " +
            "department = #{department}, " +
            "section = #{section}, " +
            "overtimeHour = #{overtimeHour}, " +
            "operation = #{operation}, " +
            "category = #{category}, " +
            "reason = #{reason}, " +
            "overtimeDate = #{overtimeDate} " +
            "WHERE id = #{id} AND sys_deleted = 0")
    void update(overtimeMonitoringPojo overtimeMonitoringPojo);
}
